package com.shengyin.ec.service.account;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shengyin.ec.model.dao.account.ReceiverDao;
import com.shengyin.ec.model.entity.Receiver;

@Service("receiverService")
public class ReceiverServiceImpl  implements ReceiverService{
	
	@Autowired
	ReceiverDao receiverDao;
	
	@Override
	public List<Receiver> getReceiverListById(long id){
		List<Receiver> listReceiver = receiverDao.getReceiverListById(id);
		return listReceiver;
	}
	
	public void createReceiver(Receiver receiver){
		receiverDao.save(receiver);
	}

	@Override
	public Receiver getReceiver(long id) {
		return receiverDao.get(id);
	}

	@Override
	public void setDefaultReceiver(long userId, long receiverId) {
		receiverDao.setDefaultReceiver(userId, receiverId);
	}

	@Override
	public void deleteReceiver(Receiver receiver) {
		receiverDao.delete(receiver);
	}

	@Override
	public void updateReceiver(Receiver receiver) {
		receiverDao.update(receiver);
	}
}